import 'package:flutter/material.dart';

class MyIconButton extends StatelessWidget {
  final IconData icon;
  final double size;
  // 事件
  final Function()? onPressed;


  const MyIconButton({super.key, required this.icon, this.size = 18, this.onPressed});

  @override
  Widget build(BuildContext context) {
    return IconButton(
        onPressed: onPressed,
        style: ButtonStyle(
          backgroundColor: WidgetStateProperty.all<Color>(Colors.white),
          padding: WidgetStateProperty.all<EdgeInsets>(
              const EdgeInsets.symmetric(horizontal: 8, vertical: 8)),
          minimumSize: WidgetStateProperty.all<Size>(const Size(0, 0)),
        ),
        icon: Icon(
          icon,
          size: size,
          color: Colors.black,
        ));
  }
}
